package com.leoman.spinningmachine.tab3;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.leoman.helper.adapter.BaseRecyclerAdapter;
import com.leoman.spinningmachine.R;
import com.leoman.spinningmachine.util.DateUtil;
import com.leoman.spinningmachine.util.SharedPreferencesUtils;

import java.util.List;

/**
 * Created by Administrator on 2018-05-14.
 */
public class CardRecordAdapter extends BaseRecyclerAdapter{
    public CardRecordAdapter(int redId, List<String> list) {
        super(redId,list);
    }

    @Override
    protected void bindTheData(BaseViewHolder holder, Object data, int position) {

        TextView tv_card_start_time = (TextView)holder.findViewById(R.id.tv_card_start_time);

        if(position == 0){
            ((ImageView)holder.findViewById(R.id.im_morning)).setImageResource(R.drawable.ic_morning);
            tv_card_start_time.setText("打卡时间 "+ SharedPreferencesUtils.getInstance().getString(DateUtil.getTodayStr()+"-time") +"(上班时间08:50)");
        }
        else if(position == 1){
            TextView tv_stage = (TextView) holder.findViewById(R.id.tv_stage);
            tv_stage.setBackgroundResource(R.drawable.card_normal_tv);
            tv_stage.setText("正常");
            ((ImageView)holder.findViewById(R.id.im_morning)).setImageResource(R.drawable.ic_night);
            ((View) holder.findViewById(R.id.view)).setVisibility(View.INVISIBLE);
            tv_card_start_time.setText("打卡时间 "+ "18:00" +"(下班时间18:00)");
        }
    }
}
